using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_batchesMap : EntityTypeConfiguration<so_batches>
    {
        public so_batchesMap()
        {
            // Primary Key
            this.HasKey(t => new { t.RECURRING, t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.BATCH)
                .HasMaxLength(8);

            this.Property(t => t.description)
                .HasMaxLength(100);

            this.Property(t => t.Hijri)
                .HasMaxLength(10);

            this.Property(t => t.PERIOD)
                .HasMaxLength(4);

            this.Property(t => t.Cost_center)
                .HasMaxLength(30);

            this.Property(t => t.USERname)
                .HasMaxLength(15);

            this.Property(t => t.origin)
                .HasMaxLength(2);

            this.Property(t => t.RECURRING)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(81);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(36);

            // Table & Column Mappings
            this.ToTable("so_batches");
            this.Property(t => t.BATCH).HasColumnName("BATCH");
            this.Property(t => t.description).HasColumnName("description");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.Hijri).HasColumnName("Hijri");
            this.Property(t => t.Total_base_1).HasColumnName("Total_base_1");
            this.Property(t => t.Debit_base_1).HasColumnName("Debit_base_1");
            this.Property(t => t.credit_base_1).HasColumnName("credit_base_1");
            this.Property(t => t.Total_base_2).HasColumnName("Total_base_2");
            this.Property(t => t.Debit_base_2).HasColumnName("Debit_base_2");
            this.Property(t => t.credit_base_2).HasColumnName("credit_base_2");
            this.Property(t => t.PERIOD).HasColumnName("PERIOD");
            this.Property(t => t.CLOSING).HasColumnName("CLOSING");
            this.Property(t => t.Cost_center).HasColumnName("Cost_center");
            this.Property(t => t.USERname).HasColumnName("USERname");
            this.Property(t => t.origin).HasColumnName("origin");
            this.Property(t => t.RECURRING).HasColumnName("RECURRING");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
